package gov.moandor.schultegrid;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Button;

public class NumberButton extends Button implements Button.OnClickListener {
	private int mNum;
	private OnNumberClickListener mListener;
	
	public NumberButton(Context context) {
		super(context);
	}
	
	public NumberButton(Context context, AttributeSet attrs) {
		super(context, attrs);
	}
	
	public NumberButton(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}
	
	public void onClick(View v){
		mListener.onNumberClick(mNum);
	}
	
	public void setNum(int num) {
		mNum = num;
		setText(String.valueOf(num));
	}
	
	public void setOnNumberClickListener(OnNumberClickListener listener) {
		mListener = listener;
		setOnClickListener(this);
	}
	
	public static interface OnNumberClickListener {
		public void onNumberClick(int num);
	}
}
